﻿using System.Windows;
using System.Windows.Interactivity;

namespace Wen.Core.Behaviors
{
	public class DragMoveBehavior : Behavior<Window>
	{
		protected override void OnAttached() {
			base.OnAttached();
			AssociatedObject.MouseDown += AssociatedObjectMouseDown;
		}

		void AssociatedObjectMouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e) {
			AssociatedObject.DragMove();
		}

		protected override void OnDetaching() {
			base.OnDetaching();
			AssociatedObject.MouseDown -= AssociatedObjectMouseDown;
		}
	}
}
